<?php
session_start();


$conexao = pg_connect("dbname=projeto user=postgres password=postgres host=localhost");


    function comprar($id_jogador){
        $usuario = $_SESSION['usuario'];
        $res1 = pg_query('UPDATE jogador SET id_time = '.$usuario['id_time'].' WHERE id_jogador = '.$id_jogador.'' );
        
        pg_execute($res1);
     
        
        
    }
?>


<?php
session_start();



$msg1 = "Seja Bem-Vindo ";
$msg2 = $_SESSION['usuario']->nome;
?>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN" dir="ltr">
    <head profile="http://gmpg.org/xfn/11">
        <title>EAIManager 2013 - partiu jogar?</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="imagetoolbar" content="no" />
        <link rel="stylesheet" href="../css/estilo.css" type="text/css" />
        <script type="text/javascript" src="../js/jquery-1.4.1.min.js"></script>
        <script type="text/javascript" src="../js/jquery.jcarousel.pack.js"></script>
        <script type="text/javascript" src="../js/jquery.jcarousel.setup.js"></script>
        <script type="text/javascript" src="../js/validacao.js"></script>  
    </head>
    <body id="top">
        <!-- ####################################################################################################### -->
        <div class="wrapper col1">
            <div id="header">
                <div id="logo" class="fltleft">
                    <h1><a href="#">EAIManager</a></h1>
                    <p>partiu jogar? </p> 
                </div> 
                <div id="divlogin">

                    <a href="">
                        <?php echo $msg1;
                        echo $msg2;
                        ?>
                    </a>! <a href="http://localhost/projeto/Control/controle.php?acao=sair"> Sair[X]</a>
                    <!--                    <a href="usuario/edita.php">Editar informações</a><>
                                        <a href="time/cadastro.php">Criar Time</a>
                                        <a href="../Control/controle.php?acao=editarTime">Meu Time</a>-->
                    </a>
                </div>

                <br class="clear" />
            </div>
        </div>
        <!-- ####################################################################################################### -->
        <div class="wrapper col3">


            
            <div id="caixa">
                <nav id="menu">
	<ul>
		<li><a href="http://localhost/projeto/View/painel.php">Painel de Controle</a></li>
                <li><a href="http://localhost/projeto/Control/controle.php?acao=editarTime">Meu time</a></li>
		<li><a href="http://localhost/projeto/View/usuario/edita.php">Informações</a></li>
		<li><a href="http://localhost/projeto/View/lista_transferencia.php">Mercado</a></li>
		<li><a href="http://localhost/projeto/Control/controleJogo.php">Jogo</a></li>
	</ul>
</nav>
 <?php

    
        $id_jogador = $_REQUEST['id_jogador'];        

        
        $res = pg_query('select * from jogador where id_jogador =' . $id_jogador);

    
        
        while ($escrever = pg_fetch_array($res)) {
            
            echo 'Nome: ' . $escrever['nome'];?> </br> <?php
            echo 'Time: ' . $escrever['id_time'];?> </br> <?php
            echo 'Idade: ' . $escrever['idade'];?> </br> <?php
            echo 'Peso: ' . $escrever['peso'];?> </br> <?php
            echo 'Altura: ' . $escrever['altura'];?> </br> <?php
            echo 'Pe: ' . $escrever['pe'];?> </br> <?php
            echo 'Potencia: ' . $escrever['potencia'];?> </br> <?php
            echo 'Potencia do passe: ' . $escrever['potencia_passe'];?> </br> <?php
            echo 'Precisao: ' . $escrever['precisao'];?> </br> <?php
            echo 'Precisao do passe: ' . $escrever['precisao_passe'];?> </br> <?php
            echo 'Tecnica: ' . $escrever['tecnica'];?> </br> <?php
            echo 'Tecnica do passe: ' . $escrever['tecnica_passe'];?> </br> <?php
            echo 'Velocidade: ' . $escrever['velocidade'];?> </br> <?php
            echo 'Drible: ' . $escrever['drible'];?> </br> <?php
            echo 'Forca: ' . $escrever['forca'];?> </br> <?php
            echo 'Resistencia: ' . $escrever['resistencia'];?> </br> <?php
            echo 'Marcacao: ' . $escrever['marcacao'];?> </br> <?php
            echo 'Desarme: ' . $escrever['desarme'];?> </br> <?php
            echo 'Inteligencia: ' . $escrever['inteligencia'];?> </br> <?php
            echo 'Salario: ' . $escrever['salario'];?> </br> <?php
            echo 'Valor: ' . $escrever['valor'];?> </br> <?php
            echo 'Posicao: ' . $escrever['posicao'];?> </br> <?php
            echo 'Estrela: ' . $escrever['estrela'];?> </br> 
        
            <input type="button" id="enviar" name="enviar" action="comprar($escrever['id_jogador'])" value="Comprar!"/>
            
            <?php
        }
        
        
        pg_close($conexao);
        ?>

                <br class="clear" />
            </div>

        </div>
        <!-- ####################################################################################################### -->
        <div class="wrapper col4">
            <div id="footer">
                <br class="clear" />
            </div>
        </div>
        <!-- ####################################################################################################### -->
        <div class="wrapper col5">
            <div id="copyright">
                <p class="fl_left">Copyright &copy; 2013 - All Rights Reserved - <a href="#">EAICode</a></p>
                <br class="clear" />
            </div>
        </div>
    </body>
</html>


       